package com.es.business.city;

import javax.servlet.http.HttpServletRequest;

import com.es.business.area.AreaBiz;
import com.es.business.citys.CitysBiz;
import com.es.business.province.ProvinceBiz;
import com.opensymphony.webwork.interceptor.ServletRequestAware;
import com.opensymphony.xwork.ActionSupport;

public class CityModifyInitAction extends ActionSupport
implements ServletRequestAware{
	 HttpServletRequest request;

	public void setServletRequest(HttpServletRequest paramHttpServletRequest) {
		// TODO Auto-generated method stub
		this.request = paramHttpServletRequest;
	}
	
	public String execute() throws Exception{
		String result = "";
		
		String city_id = "";
		if(request.getParameter("city_id") != null)
			city_id = request.getParameter("city_id");
			
	    CityBiz citysBiz = new CityBiz();
	    CityBean cityBean = citysBiz.getCityById(city_id);
	   
	    request.setAttribute("pBean", cityBean);
	    request.setAttribute("cityslist", new CitysBiz().getCitysList());
	    request.setAttribute("provinceList", new ProvinceBiz().getProvinceList());
	    request.setAttribute("provinceCode", cityBean.getProvinceCode());
	    request.setAttribute("citysCode", cityBean.getCitysCode());
	    request.setAttribute("updateCitysCode", cityBean.getCityCode());
	    request.setAttribute("updateCitysValue", cityBean.getCityName());
	    request.setAttribute("updateCitysLevel", cityBean.getCityLevel());
		result = "success";
		
		return result;
	}
	 

}
